import React, { Component } from 'react'

export default class App extends Component {
  /* state={
    Mytext: '收藏', 
    isshow:true
  } */
  constructor() {
    super()
    this.state = {
      Mytext: '收藏', 
      isshow:true,
      uname:'zhangsan'
    }
  }
  render() {
    return (
      <div>
        <h1>react State</h1>
        <button onClick={()=>{this.setState({isshow:!this.state.isshow,uname:'王五'})
                if (this.state.isshow){
                  console.log("收藏")
                }else{
                  console.log("取消")
                }
      }}>{this.state.isshow?'收藏':'取消收藏'}---{this.state.uname}</button>
      </div>
    )
  }
}
